﻿using System.Globalization;
using System.Web.Mvc;
using Fuse8.ContentManagementFramework.SystemFacade.Globalization;

namespace Fuse8.ContentManagementFramework.Administration
{
    public abstract class CmsAdminPage<T> : WebViewPage<T>
    {
        public string ResFile { get; set; }
        public string _(string original, params object[] values)
        {
            return GetProvider().GetText(original, values);
        }
        public string __(string single, string plural, long number, params object[] values)
        {
            return GetProvider().GetPluralText(single, plural, number, values);
        }

        private IGetTextProvider GetProvider()
        {
            //todo: get resource domain from controller name
            return GlobalizationFacade.Current.WithDomain(ResFile ?? "cms_Common", CultureInfo.CurrentUICulture);
        }
    }
}